package avicit.bdp.dgs.metadata.service;

import avicit.bdp.common.base.BaseService;
import avicit.bdp.common.service.dto.ColumnPartitionedDTO;
import avicit.bdp.dgs.metadata.dao.MetadataTableColumnPartitionDao;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * 数据表元数据分区数据
 *
 * @author mayanj
 */
@Service
public class MetadataTableColumnPartitionService
    extends BaseService<MetadataTableColumnPartitionDao, ColumnPartitionedDTO> {

  public void deleteByTableId(String tableId) {
    this.mapper.deleteByTableId(tableId);
  }

  public void batchInsert(List<ColumnPartitionedDTO> columnPartitionedList) {
    this.mapper.batchInsert(columnPartitionedList);
  }

  public Page<ColumnPartitionedDTO> selectPageList(
      String tableId, String keyWords, Integer pageNo, Integer pageSize) {
    PageHelper.startPage(pageNo, pageSize);
    return this.mapper.selectPageList(tableId, keyWords);
  }

  public int deleteByDatasourceId(String datasourceId) {
    return this.mapper.deleteByDatasourceId(datasourceId);
  }
}
